package com.project.stream_producer.demo3.controller;

import com.project.stream_producer.demo3.service.MessageDemo3Producer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SendDemo3Controller {
    @Autowired
    MessageDemo3Producer messageDemo3Producer;
    @GetMapping("demo3/sendMsg")
    public void sendMsg(){
        for (int i = 0; i < 10; i++) {
            if(i>5) {
                System.out.println(messageDemo3Producer.send(i,1));
            }else{
                System.out.println(messageDemo3Producer.send(i,2));
            }
        }
    }
}
